package com.cq.hd.app.controller;

import com.cq.hd.common.response.Result;
import com.cq.hd.system.api.TbHfRegionsApi;
import com.cq.hd.system.api.vo.HfRegionVo;
import com.cq.hd.system.api.vo.RegionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "汇付地区相关接口")
@Slf4j
@RestController
@RequestMapping("/hfRegions")
public class HfRegionController {

    @Autowired
    private TbHfRegionsApi hfRegionsApi;

    @ApiOperation(value = "根据id获取汇付的省市区列表数据")
    @ApiImplicitParam(name = "id", value = "id:0：获取省份，其他id：获取市区数据", defaultValue = "0", paramType = "query", dataType = "Integer")
    @ApiResponse(response = HfRegionVo.class, code = 200, message = "接口返回对象参数")
    @GetMapping("/listById")
    public Result<List<HfRegionVo>> listHfRegionById(Integer id) {
        return hfRegionsApi.listHfRegionById(id);
    }

    @ApiOperation(value = "获取汇付的省市列表所有数据")
    @ApiImplicitParam(name = "cityName", value = "市区名称", paramType = "query", dataType = "String")
    @ApiResponse(response = RegionVo.class, code = 200, message = "接口返回对象参数")
    @GetMapping("/listAllRegion")
    public Result<List<HfRegionVo>> listAllRegion() {
        return hfRegionsApi.listAllRegion();
    }

}
